from extensions.models import *


class Downloads_log(Model):
    """七库全书下载记录"""
    clsbbfak = ForeignKey('clsbb.Clsbbfak_Records', on_delete=CASCADE, blank=True, default=None, related_name='Downloads_records')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='Downloads_records')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

    class Meta:
        ordering = ['-add_time']

class Views_log(Model):
    """七库浏览记录"""
    clsbbfak = ForeignKey('clsbb.Clsbbfak_Records', on_delete=CASCADE, blank=True, default=None, related_name='Views_records')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='Views_records')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

    class Meta:
        ordering = ['-add_time']


class Alk_Downloads_log(Model):
    """案例库下载记录"""
    clsbbalk = ForeignKey('clsbb.Clsbbalk_Records', on_delete=CASCADE, blank=True, default=None, related_name='Alk_Downloads_log')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='Alk_Downloads_log')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

class Alk_Views_log(Model):
    """案例库浏览记录"""
    clsbbalk = ForeignKey('clsbb.Clsbbalk_Records', on_delete=CASCADE, blank=True, default=None, related_name='Alk_Views_log')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='Alk_Views_log')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)


class Tbk_Downloads_log(Model):
    """投标库下载记录"""
    clsbbtbk = ForeignKey('clsbb.Clsbbtbk_Records', on_delete=CASCADE, blank=True, default=None, related_name='Tbk_Downloads_log')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='Tbk_Downloads_log')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

class Tbk_Views_log(Model):
    """投标库浏览记录"""
    clsbbtbk = ForeignKey('clsbb.Clsbbtbk_Records', on_delete=CASCADE, blank=True, default=None, related_name='Tbk_Views_log')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='Tbk_Views_log')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)


class Cpk_Downloads_log(Model):
    """产品库下载记录"""
    clsbbcpk = ForeignKey('clsbb.Clsbbcpk_Records', on_delete=CASCADE, blank=True, default=None, related_name='cpk_Downloads_log')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='cpk_Downloads_log')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

class Cpk_Views_log(Model):
    """产品库浏览记录"""
    clsbbcpk = ForeignKey('clsbb.Clsbbcpk_Records', on_delete=CASCADE, blank=True, default=None, related_name='cpk_Views_log')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='cpk_Views_log')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)


class Hzhbk_Downloads_log(Model):
    """合作伙伴库下载记录"""
    clsbbhzhbk = ForeignKey('clsbb.Clsbbhzhbk_Records', on_delete=CASCADE, blank=True, default=None, related_name='hzhbk_Downloads_log')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='hzhbk_Downloads_log')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

class Hzhbk_Views_log(Model):
    """合作伙伴库浏览记录"""
    clsbbhzhbk = ForeignKey('clsbb.Clsbbhzhbk_Records', on_delete=CASCADE, blank=True, default=None, related_name='hzhbk_Views_log')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='hzhbk_Views_log')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)


class Gszzk_Downloads_log(Model):
    """公司资质库下载记录"""
    clsbbgszzk = ForeignKey('clsbb.Clsbbgszzk_Records', on_delete=CASCADE, blank=True, default=None, related_name='gszzk_Downloads_log')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='gszzk_Downloads_log')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

class Gszzk_Views_log(Model):
    """公司资质库浏览记录"""
    clsbbgszzk = ForeignKey('clsbb.Clsbbgszzk_Records', on_delete=CASCADE, blank=True, default=None, related_name='gszzk_Views_log')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='gszzk_Views_log')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)


class Ryzzk_Downloads_log(Model):
    """人员资质库下载记录"""
    clsbbryzzk = ForeignKey('clsbb.Clsbbryzzk_Records', on_delete=CASCADE, blank=True, default=None, related_name='ryzzk_Downloads_log')
    download_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='ryzzk_Downloads_log')  # 下载人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)

class Ryzzk_Views_log(Model):
    """人员资质库浏览记录"""
    clsbbryzzk = ForeignKey('clsbb.Clsbbryzzk_Records', on_delete=CASCADE, blank=True, default=None, related_name='ryzzk_Views_log')
    view_by = ForeignKey('system.User', on_delete=SET_NULL,null=True, blank=True, default=None,
                           related_name='ryzzk_Views_log')  # 浏览人
    add_time = DateTimeField(auto_now_add=True, verbose_name='创建时间', null=True, blank=True)
